﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SD.DataAccess;
using SD.Commons.DataFilters;

namespace SD.Business
{
    // author: ToanTN, 21 Dec 2012
    public class OrganizationBUS
    {
        /// <summary>
        /// Get organization
        /// </summary>
        /// <param name="maximumRows">max rows</param>
        /// <param name="startRowIndex">start row index</param>
        /// <param name="filter">filter</param>
        /// <param name="sortType">sort type</param>
        /// <returns>List organizations</returns>
        public static IQueryable<Organization> GetOrganizations(int maximumRows, int startRowIndex, 
            OrganizationFilter filter = null,
            string sortType = null)
        {
            return Organization.GetOrganizations(filter, startRowIndex, maximumRows, sortType);
        }

        /// <summary>
        /// Count organization
        /// </summary>
        /// <param name="filter">the filter</param>
        /// <returns></returns>
        public static int CountOrganizations(OrganizationFilter filter)
        {
            return Organization.CountOrganizations(filter);   
        }

        /// <summary>
        /// Sets the active organization.
        /// </summary>
        /// <param name="organizationId">The organization id.</param>
        /// <param name="status">if set to <c>true</c> [status].</param>
        /// <returns></returns>
        public static bool SetOrganizationStatus(int organizationId, bool status)
        {
            return Organization.SetActiveOrganization(organizationId, status);
        }
    }
}
